package com.hd.service.test;

import java.util.List;

import com.hd.common.DataPage;
import com.hd.persistence.model.Machine;
import com.hd.utils.HdException;

public class MachineManagerTestCase extends BaseTest {
	
	//保存实体
//	public void testSaveMachine() throws HdException {
//		for ( int i = 0; i < 10; i++ ) {
//			Machine machine = new Machine();
//			machine.setBrand(i);
//			machine.setMachineModel("OOXX" + i);
//			machine.setCategory(0);
//			memberManager.saveMachine(machine);
//		}
//	}
	
	//分页查询
	public void testPageQueryMachines() throws HdException {
		DataPage<Machine> dataPage = memberManager.pageQueryMachines(1,1, 10);
		System.out.println("查询总数为:" + dataPage.getTotalCount());
		List<Machine> machines = dataPage.getData();
		for ( Machine machine : machines ) {
			System.out.println(machine.getBrand() + " " + machine.getMachineModel());
		}
		
	}
	
	//查询所有机器信息
	public void testListMachines() throws HdException{
		List<Machine> machines = memberManager.listMachine();
		for ( Machine machine : machines ) {
			System.out.println(machine.getBrand() + " " + machine.getMachineModel());
		}
	}
	
}
